home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1994 December
/
1994-12b.d64
/
jump start
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
8KB
|
249 lines
1 goto 100
2 save"jump start.pgml",8
3 rem
4 rem
5 rem
6 verify"jump start.pgml",8
10 sys4096*9: rem re-enable metabasic after run-stop/restore
11 key 1,"[147]list":rem set keys-metabasic
12 rem
13 rem
14 key 2,"[147]llist"
15 rem
16 rem
17 key 3,"[147]run_"
18 rem
19 rem
20 key 4,"[147]": rem list section in devel
21 rem
22 rem
23 key 5,"[147]": rem list a ref section
24 rem
25 rem
26 key 6,"[147]find@"
27 rem
28 rem
29 key 7,"delete"
30 rem
31 rem
40 rem 10000 * print a pgm listing
42 rem 11000 * print screen routine
44 rem 11200 * display directory ****
46 rem 12000 * rtn to open/read file(s)
48 rem 12300 * decimal format routine
50 rem 12400 * 5 option sub menu
52 rem 13000 * generic shell sort
100 rem ************* numeric variables
101 a=0 : rem tells sort # of entries
102 b=0 : rem binary value of high middle of matrix
103 c=0 : rem moving pointer to compare current position to fixed higher pos
104 d=0 : rem 'fixed' higher pos pointer
110 tb=8: rem tab value for options
120 sl=0: rem choice of option
130 c1=.5: rem constant needed @ 12300
132 c2=1: rem constant nneded @ 12300
134 c3=100: rem constant needed @ 12300
140 na=0: rem next address (12000)
141 nn=0: rem counter (12000)
142 mx=0: rem = max size of array (12000)
143 t =0: rem receives ascii val of input
150 v=0 : rem see 12302
151 fr=0: rem see 12330 - fraction
152 lo=0: rem see 12330
153 j=0 : rem see 12320
200 rem **** main menu options
210 tl$="program title here"
221 o1$="opt #1" : rem main menu opt 1
222 o2$="opt #2" : rem main menu opt 2
223 o3$="opt #3" : rem etc.
224 o4$="opt #4"
225 o5$="not active"
226 o6$="not active"
227 o7$="not active"
228 o8$="not active"
229 o9$="calculate free space"
230 o0$="print screen"
239 rem ***** string variables
240 a$=" ": rem see 12000
245 n$=" ": rem see 12360-formatted dec
300 rem array dimensions defined here
310 dim m(20): rem sample array to be sorted - see 13000
400 rem **** main menu handler *****
410 print"[147]":printtab((40-len(tl$))/2);tl$:rem program title - centered
420 print
430 printtab(tb)"[144] 1.[146] ";o1$:print
435 printtab(tb)" 2.[146] ";o2$:print
440 printtab(tb)" 3.[146] ";o3$:print
445 printtab(tb)"[159] 4.[146] ";o4$:print
450 printtab(tb)"[156] 5.[146] ";o5$:print
455 printtab(tb)" 6.[146] ";o6$:print
460 printtab(tb)" 7.[146] ";o7$:print
465 printtab(tb)"[158] 8.[146] ";o8$:print
470 printtab(tb)"[144] 9.[146] ";o9$:print
475 printtab(tb)"10.[146] ";o0$:print
480 print"your selection, please";:input sl
485 if sl<1 or sl>10 then 400
489 rem label- / / / / / / / / / /
490 on sl goto 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 11000
498 rem line 489 allows 4 character labels above corresponding goto address to
499 rem help trouble shooting & maint
500 rem initializing sub-routine 1
600 rem initializing sub-routine 2
700 rem initializing sub-routine 3
800 rem initializing sub-routine 4
900 rem initializing sub-routine 5
1000 rem **************** option 1
1004 print"[147]"
1005 print"you have chosen option 1"
1010 print"shift-return to main":wait653,1:goto400:rem code this option follows
2000 rem **************** option 2
2004 print"[147]"
2005 print"you have chosen option 2"
2010 print"shift-return to main":wait653,1:goto400:rem code this option follows
3000 rem **************** option 3
3004 print"[147]"
3005 print"you have chosen option 3"
3010 print"shift-return to main":wait653,1:goto400:rem code this option follows
4000 rem **************** option 4
4010 print"[147]"
4020 print"1 -sub opt 1-text":print
4025 print"2 -sub opt 2-text":print
4030 print"3 -sub opt 3-text":print
4035 print"4 -sub opt 4-text":print
4040 print"5 -exit":print
4050 input"enter your option #"; sl
4060 if sl <1 or sl >5 then goto 4010
4070 on sl goto 4100,4200,4300,4400,4500
4080 goto 4000
4100 rem ***** option 1
4105 print"you have chosen sub-opt 1"
4110 print"shift-return to sub ":wait653,1:goto4000:rem code follows
4199 goto4000
4200 rem ***** option 2
4205 print"you have chosen sub-opt 2"
4210 print"shift-return to main":wait653,1:goto4000:rem code follows
4299 goto4000
4300 rem ***** option 3
4305 print"you have chosen sub-opt 3"
4310 print"shift-return to main":wait653,1:goto4000:rem code follows
4399 goto4000
4400 rem ***** option 4
4405 print"you have chosen sub-opt 4"
4410 print"shift-return to main":wait653,1:goto4000:rem code follows
4499 goto4000
4500 rem ***** option 5 - exit to main menu
4505 print"you have chosen sub-opt 5"
4510 print"shift-return to main":wait653,1:goto400:rem code follows
5000 rem **************** option 5
5010 print"shift to return":wait653,1:goto400:rem code for this option follows
6000 rem **************** option 6
6010 print"shift to return":wait653,1:goto400:rem code for this option follows
7000 rem **************** option 7
7010 print"shift to return":wait653,1:goto400:rem code for this option follows
8000 rem **************** option 8
8010 print"shift to return":wait653,1:goto400:rem code for this option follows
9000 rem **************** free space
9005 print fre(0) - (fre(0)<0)*65536
9010 print"shift to return":wait653,1:goto400:rem code for this option follows
10000 rem *************** print listing
10010 open4,4:cmd4:list::print#4:close4:rem - with metabasic, use llist instead
10020 print"shift to return":wait653,1:goto400:rem code for option follows
11000 rem ******** print screen routine
11010 print""; :rem clear screen
11020 open 3,3,3 :rem open screen as device 3 for input
11030 open 4,4,0 :rem open printer as dev 4 for output
11040 for i = 0 to1024:rem 1024 screen positions
11050 :get#3,a$ :rem get screen data
11060 :print#4,a$; :rem print screen data
11070 next :rem repeat 1024 times
11080 print#4 :rem final print
11090 close3 :rem close dev 3
11100 close4 :rem close dev 4
11110 goto400 :rem return main menu
11200 rem ******display directory ****
11210 open 2,8,0,"$":print"[147]"
11220 get#2,a$:get#2,a$
11230 get#2,l$:get#2,l$:ifst=64thenclose2:return
11240 get#2,lb$:get#2,hb$:ln=asc(lb$+chr$(0))+256*asc(hb$+chr$(0))
11250 print ln;
11260 get#2,a$:ifa$=""then printchr$(13);:goto11230
11270 printa$;:goto11260
12000 rem subrtn to open/read file(s)
12010 input"enter name of file";f$
12020 open 2,8,2,f$:nn=0
12040 get#2,a$:get$2,a$
12050 get#2,a$:if st<>0then 12110
12060 rem 31 '_' is carriage return
12070 t = asc(a$+"@")
12080 if t=31 then na=nn+1:goto12090
12085 if nn>mxthenprint"array not large enough":goto12120
12090 n$(nn)=n$(nn)+a$:nn=na
12100 goto12050
12110 n$(nn)=n$(nn)+chr$(31)
12120 close#2:return
12300 rem decimal format routine
12302 rem expects-v=value to round/prt
12303 rem expects-c1=.5,c2=1,c3=100
12304 rem returns-n$
12305 n$=str$(int(v*c3+c1)/c3)
12310 lo=len(n$)
12320 for j = 2 to lo
12330 :if mid$(n$,j,1)="." then fr = lo-j:j = lo
12340 next
12350 on fr+c2 goto 12370,12380,12390
12360 n$=left$(n$,lo-fr+2): goto12390
12370 n$=n$+".00":return
12380 n$=n$+"0"
12390 fr=0:return
12400 rem **** 5 option sub menu ****
12405 rem copy and renumber this code to any section of code where needed!
12406 rem add the correct option names between the quotes in 12420 - 12440
12410 print"[147]"
12420 print"1 -sub opt 1-text":print
12425 print"2 -sub opt 2-text":print
12430 print"3 -sub opt 3-text":print
12435 print"4 -sub opt 4-text":print
12440 print"5 -exit":print
12450 input"enter your option #"; sl
12460 if sl <1 or >5 then goto 12400
12470 on sl goto 12500,12600,12700,12800,12900
12480 goto 400
12500 rem ***** option 1
12599 goto12400
12600 rem ***** option 2
12699 goto12400
12700 rem ***** option 3
12799 goto12400
12800 rem ***** option 4
12899 goto12400
12900 rem ***** option 5 - exit to main menu
12999 goto400
13000 rem generic shell sort
13001 rem routine expects a=the number of rows in the matrix (m) to be sorted
13002 rem by adjusting m(c) etc statements, can sort any field on any array
13003 rem
13004 print"[147]": rem clear screen
13005 b=1: rem find the value of the index which is
13006 rem just > a
13010 b=b*2: rem